<?php

class newpasswordForm extends sfForm {

    public function configure() {
        $_i18 = sfContext::getInstance()->getI18N();
        $this->validatorSchema->setOption('allow_extra_fields', true);
        $this->validatorSchema->setOption('filter_extra_fields', false);


        // WIDGETS
        $this->setWidget('password2', new sfWidgetFormInputPassword());
        $this->setWidget('password', new sfWidgetFormInputPassword(array('label' => $_i18->__('Type new password.'))));

        //validators
        $this->setValidator('password', new sfValidatorString(array('max_length' => 15, 'required' => true, 'min_length' => 6), array(
                    'max_length' => $_i18->__('Too long(Minimum 15 characters).'),
                    'required' => $_i18->__('Required field.'),
                    'min_length' => $_i18->__('Too short(Minimum 6 characters).')
                )));

        $this->validatorSchema->setPostValidator(
                new sfValidatorAnd(array(new sfValidatorSchemaCompare('password2', '==', 'password', array(), array(
                        'invalid' => $_i18->__('Passwords do not match.'),
                      
                    )))));

        $this->widgetSchema->setNameFormat('new[%s]');
    }

}